package com.bakerj.infinitecards.transformer;

import com.bakerj.infinitecards.CardItem;
import com.bakerj.infinitecards.ZIndexTransformer;

/**
 * DefaultZIndexTransformerToFront
 *
 * @author BakerJ
 * @since : 2021.5.24
 */
public class DefaultZIndexTransformerToFront implements ZIndexTransformer {
    @Override
    public void transformAnimation(CardItem card, float fraction, int cardWidth,
                                    int cardHeight, int fromPosition, int toPosition) {
        if (fraction < 0.5f) {
            card.zIndex = (float) (1F + 0.01F * (double)fromPosition);
        } else {
            card.zIndex = (float) (1F + 0.01F * (double)toPosition);
        }
    }

    @Override
    public void transformInterpolatedAnimation(CardItem card, float fraction,
                                                int cardWidth, int cardHeight, int fromPosition, int toPosition) {
    }
}
